import {ORDER_DATA} from "../actions/actionTypes.js";

const initState = {
  lists: []
}
const getOrderdata = (state, action) => {
  if (action.page === 0) {
    return {...state, lists: action.obj.data.digestlist}
  } else {
    let lists = state.lists
    return {...state, lists: lists.concat(action.obj.data.digestlist)}
  }
}
const orderReducer = (state = initState, action) => {
  switch (action.type) {
    case ORDER_DATA:
      return getOrderdata(state, action)
    default:
      return state
  }
}
export default orderReducer